const { OWNER_MENU_TYPE, PAGE_TYPE, REDIRECT_TYPE, NAV_TYPE } = require('./types');

// 路由地址，统一管理
const PAGE_NAV = {
    index: '/pages/index/index',
    owner: '/pages/owner/index',
    cardDetail: '/pages/card-detail/index',
    cardRecharge: '/pages/card-recharge/index',
    cardJoin: '/pages/card-join/index',
    couponList: '/pages/coupon-list/index',
    live: '',
    orderList: `/pages/webview/index?type=${REDIRECT_TYPE.orderList}`,
    orderDetail: `/pages/webview/index?type=${REDIRECT_TYPE.orderDetail}`,
    cart: `/pages/webview/index?type=${REDIRECT_TYPE.cart}`,
    address: `/pages/webview/index?type=${REDIRECT_TYPE.address}`,
    addressSelect: '/pages/address-change/index',
    goodsDetail: `/pages/webview/index?type=${REDIRECT_TYPE.goodsDetail}`,
    classify: `/pages/webview/index?type=${REDIRECT_TYPE.classify}`,
    special: `/pages/webview/index?type=${REDIRECT_TYPE.special}`,
    prefecture: `/pages/webview/index?type=${REDIRECT_TYPE.prefecture}`,
    pay: '/pages/pay/index',
    orderStatus: '/pages/order-status/index',
    liveRoom: 'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin',
    balanceLog: '/pages/balance-log/index',
};

const COMMON_PAGE = {
    // 首页
    index: PAGE_NAV.index,
    // 分组
    classify: PAGE_NAV.classify,
    // 购物车
    cart: PAGE_NAV.cart,
    // 我的
    owner: PAGE_NAV.owner,
};

const FEATURE_NAV = {
    [NAV_TYPE.goodsSeo]: PAGE_NAV.prefecture,
    [NAV_TYPE.live]: PAGE_NAV.live,
    [NAV_TYPE.orderList]: PAGE_NAV.orderList,
    [NAV_TYPE.address]: PAGE_NAV.address,
};

// tabbar 路由
const TABBAR_NAV = {
    [PAGE_TYPE.home]: COMMON_PAGE.index,
    [PAGE_TYPE.classify]: COMMON_PAGE.classify,
    [PAGE_TYPE.cart]: COMMON_PAGE.cart,
    [PAGE_TYPE.owner]: COMMON_PAGE.owner,
};

// banner 跳转路由
const BANNER_NAV = {
    [NAV_TYPE.goodsSeo]: PAGE_NAV.prefecture,
    [NAV_TYPE.live]: PAGE_NAV.live,
};

const OWNER_NAV = {
    [OWNER_MENU_TYPE.orderList]: PAGE_NAV.orderList,
    [OWNER_MENU_TYPE.address]: PAGE_NAV.address,
    [OWNER_MENU_TYPE.service]: '',
};

module.exports = {
    PAGE_NAV,
    COMMON_PAGE,
    FEATURE_NAV,
    TABBAR_NAV,
    BANNER_NAV,
    OWNER_NAV,
};